package com.zzb.codegenerator.bean;

import com.zzb.codegenerator.utils.MySQLTypeToJavaType;

/**
 * 字段
 */
public class TableColumn {
    private String columnName;          //字段名
    private String propertyName;        //项目名
    private String columnType;          //字段类型
    private String propertyType;        //java属性类型
    private String propertyFullType;    //java属性类型全称
    private String columnComment;       //字段注释
    private Boolean primaryKey;         //主键
    private Boolean ref;                //是否是关联字段
    private Boolean notNull;            //是否非空
    private Boolean unsigned;           //是否非负
    private String refTable;            //关联表
    private String refColumn;           //关联字段

    public String getPropertyType() {
        return MySQLTypeToJavaType.mysql2java.get(columnType).getJavaType();
    }

    public void setPropertyType(String propertyType) {
        this.propertyType = propertyType;
    }

    public String getPropertyFullType() {
        return MySQLTypeToJavaType.mysql2java.get(columnType).getJavaFullType();
    }

    public void setPropertyFullType(String propertyFullType) {
        this.propertyFullType = propertyFullType;
    }

    public String getColumnName() {
        //return MySQLTypeToJavaType.mysql2java.get(columnType).getMysqlType();
    	return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getColumnType() {
        return columnType;
    }

    public void setColumnType(String columnType) {
        this.columnType = columnType;
    }

    public String getColumnComment() {
        return columnComment;
    }

    public void setColumnComment(String columnComment) {
        this.columnComment = columnComment;
    }

    public Boolean getPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(Boolean primaryKey) {
        this.primaryKey = primaryKey;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public Boolean getRef() {
        return ref;
    }

    public void setRef(Boolean ref) {
        this.ref = ref;
    }

    public Boolean getNotNull() {
        return notNull;
    }

    public void setNotNull(Boolean notNull) {
        this.notNull = notNull;
    }

    public Boolean getUnsigned() {
        return unsigned;
    }

    public void setUnsigned(Boolean unsigned) {
        this.unsigned = unsigned;
    }

    public String getRefTable() {
        return refTable;
    }

    public void setRefTable(String refTable) {
        this.refTable = refTable;
    }

    public String getRefColumn() {
        return refColumn;
    }

    public void setRefColumn(String refColumn) {
        this.refColumn = refColumn;
    }

    @Override
    public String toString() {
        return "TableColumn{" +
                "columnName='" + columnName + '\'' +
                ", propertyName='" + propertyName + '\'' +
                ", columnType='" + columnType + '\'' +
                ", propertyType='" + propertyType + '\'' +
                ", propertyFullType='" + propertyFullType + '\'' +
                ", columnComment='" + columnComment + '\'' +
                ", primaryKey=" + primaryKey +
                '}';
    }

}
